2013031200

Total rewrite of DB functions, further tweaks to Javascript