cleaned up code, adding dynamic updates