Removed unused variables
Moved Stack to a separate file