added error for out of stock products
refactored messages into directive
refactored