made some improvments to make it more mvc, i think.