Well I should look more into this issue, but this is my best attempt (for now)