Optimised piles. Quite hacky