Core pr 5

Fixed some user redirects and coding style.
Shared function have been added to the code.