implemented everything but loops