More work on code simplification/refactorin