Third commit - Minor code changes to rectify bugs