Deleted some useless stuff and restructured some methods