Some code tidy and added support to network credentials