Add wp.getPost and some refactoring