The current handle ling of the inpit ast is fairly basic and easily breaks. Improve it to handle both prefix and suffix.