formatting reworked with netbeans, small code cleanup