fixed and cleaned up