moved validation of posts into methods and added a validation check