simplification and code cleanup