Refactored a ton of stuff and debugged basic fd functionality