Code based on fixed.c