Cleaned up the parent and child code and added more useful comments