added constants and more explanation