Moved poses definition

Moved the assigning of the variable poses to outside the WHILE loop,
because it only needs to be executed once.