Set default values for connection
Remove redundant code and format to flow better