Refactored express code