Implementing preview, code cleanup

Changes:
- Implemented post preview functionality
- Cleaned up code
- Moved route defs out of settings into a separate file