Big messy changes, wrote full register API function