added in some logic