fixed some things + code cleanup