Some updates and necessary changes

Still have a bug in the calculation. Will be fixed soon.