fixing post, cleaning up code