Make callbacks optional
Extract placement logic into a seperate function
Remove trailing whitespaces