Fixed a few bugs. Refactored much of code.
Refactored LnF