Merging code into proper script