Add better support for aligned memory allocation and use it more extensively