Refactored Code to use better Go Syntax