added stack functionality.