Completed inverse.py but still needs major debugging