full restructure
added better code documentation