Added listeners to library and fixed some layout bugs