Added err handling, abstracted raw