implemented inverse meridbue + refactor and reuse of code