Cleaned up, will seperate later