integreated me and shonee's code