Refactors more of the codebase. Starts work on add resource panel