Merged code with Piyush's frontend