Refactor to standard go package