initial commit of "unbeautyfied" code

Code as it is used now. Note that I haven't added the db schema yet as I
do not have access to the server.