Refactored code

- Common code for all platform