Merged some code