Moved utility functions to separate file

- Moved utility functions to utils.py and form
  validators to validation.py.
- Changed template filters to be registered without
  decorators.