everything is working, even though ugly
all working and cleaned some code