Fixed rslt print, cleaned up code