Rearrange some functions
Use applicative style in eval for function application