Refactored posts into their own file

Also added sorting of posts automatically based on id