lots of changes lol
add comments, restructure code etc