cleanup (removed unused methods / parameters, simplified unnecessary complicated conditions)