Clean up and tweak theoretical part