Modified a little (Thank you KostyaKow)