Cleaned code a bit using the alist helpers