fixed some logic and added more stuff