Cleanup

Add comment and minor refactorings