Database work - new fields, added stats function, fixed masonry layout, lots of CSS/JS tweaks and some Python refactoring