Some security improvements and more refactoring.
When will this end? >_>