added more functionality and cleaned style