Moved variables to the top for better organization