Note:
Still fine tune the code for better performance