Further code refinement