fixed bugs

removed unused elements, fixed bugs, improved formatting