Move db connection data to constants
Fix execution flow - disable return statement
Refactore code - move block to  correct flow branch
Refactore code - rearrange code blocks