code cleanup & simplification