Added stock logging and dynamic minimum stock calculation