Some stuff rewritten/changed