fixing https://wso2.org/jira/browse/IDENTITY-2784
Rearrange codes
Merge pull request #55 from IsuraD/master

fixing https://wso2.org/jira/browse/IDENTITY-2784