Added Tom's refactoring suggestions