Made it shorter and slightly smarter