Scalified the code