Merged all functionality into main sketch