Optimizations to public functions

lots of code obtimization thanks to a redesing of the database
structure. everything looks so much better (code wise) there are some
css bugs that should be iron down the road, but for now, everything is
fine.