added pre_exec and more unit tests