Changes thanks to @chrifpa