Merging steven's code