Adapted common code to run on Debian