merging with Eren's code