Perfectly working version without error checks