added some program logic