Added user module, abstracted more functions to library module