minor bux fixes + code cleaning