Added maintenance to clean the files out of the database every 5 min.
Added new changes and cleaned up code.