Refactors some code.
Fixes a bug with fmap loading.