Made it working to some extent