Added faction handling and fixed some things. Also added the beginning of the database save system.