improving regex and cleaning up init function