Refactor glue application logic

- modify parameters
- add raising of glue arm earlier
- refactor glue application logic into applyGlue() function