added stack class; changed function to procedure; various updates