Rough working prototype. Need to refactor and organize witth require