Cleaned up system functions a bit