Added .getkeep for bin
refactored socket creation into its own function