added list command; cleaned some code