Working version without error checks