Finished working draft (read: needs refactor)