clean code & fixed bugs