Added sysouts for easy understanding