Title: Pascal implementation