Added constants and fixes some errors