Made it work + cleaned up code
Minor fix