Refactor functions and add aliases