Overhauled code structure, UI fixes, commenting support added